<?php

namespace app\admin\model;

use think\Model;

class AdminAdmins extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'ty_admin_admins';

    //指定主见
    protected $pk = 'id';

    //只读字段
    //protected $readonly = ['name','email'];

    //自动写入时间戳
    //protected $autoWriteTimestamp = true;

    //自动写入日期
    //protected $autoWriteTimestamp = 'datetime';

    // 设置返回数据集的对象名
    protected $resultSetType = 'collection';

    /**
     * 业务员渠道员消息
     */
    public static function selectAll($where=[])
    {
        return self::where(['gid'=>4])->select();
    }


    /**
     * 业务员->渠道
     * @return \think\model\relation\HasMany
     */
    public function channelMember()
    {
        return $this->hasMany('ChannelMember','sales_id','id');
    }

    public function ownerslist()
    {
        return $this->hasMany('ContractOwners','sales_id');
    }


}
